package com.rt.gptnext.common.exception;

import lombok.Getter;

/**
 * 业务异常
 *
 * @author gaoyiyang
 **/
public class BusinessException extends RuntimeException {

    @Getter
    private final IResultCode code;

    @Getter
    private final String message;

    public BusinessException(String message) {
        super("[" + ResultCode.FAILURE.getCode() + "]" + message);
        this.code = ResultCode.FAILURE;
        this.message = message;
    }

    public BusinessException(IResultCode resultCode) {
        super("[" + resultCode.getCode() + "]" + resultCode.getMessage());
        this.code = resultCode;
        this.message = resultCode.getMessage();
    }

    public BusinessException(IResultCode resultCode, String message) {
        super("[" + resultCode.getCode() + "]" + message);
        this.code = resultCode;
        this.message = message;
    }

}
